<template>
    
    <div class="address">
        <h1>地址管理</h1>
        <div v-for="item in list" :key="item.id" class="address-item">
            <div>{{item.name}}</div>
            <div>
                <p>{{item.mobile}}</p>
                <p>
                    <span>
                        {{item.address}}
                    </span>
                    <span>
                        {{item.address_detail}}
                    </span>
                </p>
            </div>
            <div>
                <p @click="edit(item)">图标</p>
            </div>
        </div>
        <div>
            <button @click="edit">添加地址</button>
        </div>
    </div>
</template>

<script>
import {getListAction} from '@/axios/index'
export default {
    name: 'Address',

    data() {
        return {
            list:[],
            isshow:true
        };
    },

    async mounted() {
        let res= await getListAction({openId:localStorage.getItem("openId")})
        console.log(res.data);
        this.list=res.data
    },

    methods: {
        edit(obj){
            console.log(obj);
            if(obj){
                this.$router.push({name:'editAddress',params:{"data":obj}})
            }else{
                this.$router.push({name:'editAddress'})
            }
        }
    },
};
</script>

<style scoped lang="scss">
.address{
    .address-item{
        display: flex;
    }
}
</style>